package com.xzk.ExpressInnWeb.bean;

import java.sql.Timestamp;
import java.util.Date;
import java.util.Objects;

public class Express {

    private int id;
    private String ex_num;
    private String username;
    private String userphone;
    private String company;
    private String code;
    private Timestamp intime;
    private Timestamp outtime;
    // 初始值为0表示快递刚入库
    private int status;
    private String staffphone;

    /**
     * 无参构造方法
     */
    public Express() {
    }

    /**
     * 全参构造方法
     * @param id 快递id
     * @param ex_num 快递单号
     * @param username 收件人姓名
     * @param userphone 收件人手机号
     * @param company 承运快递公司
     * @param code 取件码
     * @param intime 入库时间
     * @param outtime 出库时间
     * @param status 状态
     * @param staffphone 快递录入人手机号
     */
    public Express(int id, String ex_num, String username, String userphone, String company, String code, Timestamp intime, Timestamp outtime, int status, String staffphone) {
        this.id = id;
        this.ex_num = ex_num;
        this.username = username;
        this.userphone = userphone;
        this.company = company;
        this.code = code;
        this.intime = intime;
        this.outtime = outtime;
        this.status = status;
        this.staffphone = staffphone;
    }

    /**
     * 在创建对象时可由用户(管理员)输入部分参数的构造器
     * @param ex_num 快递单号
     * @param username 取件人姓名
     * @param userphone 取件人手机号
     * @param company 承运快递公司
     * @param staffphone 快递录入人手机号
     * @param code 取件码 (注意：取件码由系统生成，并非由前端输入)
     */
    public Express(String ex_num, String username, String userphone, String company, String staffphone, String code) {
        this.ex_num = ex_num;
        this.username = username;
        this.userphone = userphone;
        this.company = company;
        this.staffphone = staffphone;
        this.code = code;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getEx_num() {
        return ex_num;
    }

    public void setEx_num(String ex_num) {
        this.ex_num = ex_num;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getUserphone() {
        return userphone;
    }

    public void setUserphone(String userphone) {
        this.userphone = userphone;
    }

    public String getCompany() {
        return company;
    }

    public void setCompany(String company) {
        this.company = company;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public Date getIntime() {
        return intime;
    }

    public void setIntime(Timestamp intime) {
        this.intime = intime;
    }

    public Date getOuttime() {
        return outtime;
    }

    public void setOuttime(Timestamp outtime) {
        this.outtime = outtime;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public String getStaffphone() {
        return staffphone;
    }

    public void setStaffphone(String staffphone) {
        this.staffphone = staffphone;
    }

    @Override
    public String toString() {
        return "Express{" +
                "id=" + id +
                ", ex_num='" + ex_num + '\'' +
                ", username='" + username + '\'' +
                ", userphone='" + userphone + '\'' +
                ", company='" + company + '\'' +
                ", code='" + code + '\'' +
                ", intime=" + intime +
                ", outtime=" + outtime +
                ", status=" + status +
                ", staffphone='" + staffphone + '\'' +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Express express = (Express) o;
        return id == express.id && status == express.status && Objects.equals(ex_num, express.ex_num) && Objects.equals(username, express.username) && Objects.equals(userphone, express.userphone) && Objects.equals(company, express.company) && Objects.equals(code, express.code) && Objects.equals(intime, express.intime) && Objects.equals(outtime, express.outtime) && Objects.equals(staffphone, express.staffphone);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, ex_num, username, userphone, company, code, intime, outtime, status, staffphone);
    }
}
